home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / gtfont.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-11-23  |  4.7 KB  |  191 lines

  1. /*
  2. For general Scribus (>=1.3.2) copyright and licensing information please refer
  3. to the COPYING file provided with the program. Following this notice may exist
  4. a copyright and/or license notice that predates the release of Scribus 1.3.2
  5. for which a new license (GPL+exception) is in place.
  6. */
  7. /***************************************************************************
  8.  *   Copyright (C) 2004 by Riku Leino                                      *
  9.  *   tsoots@gmail.com                                                      *
  10.  *                                                                         *
  11.  *   This program is free software; you can redistribute it and/or modify  *
  12.  *   it under the terms of the GNU General Public License as published by  *
  13.  *   the Free Software Foundation; either version 2 of the License, or     *
  14.  *   (at your option) any later version.                                   *
  15.  *                                                                         *
  16.  *   This program is distributed in the hope that it will be useful,       *
  17.  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
  18.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
  19.  *   GNU General Public License for more details.                          *
  20.  *                                                                         *
  21.  *   You should have received a copy of the GNU General Public License     *
  22.  *   along with this program; if not, write to the                         *
  23.  *   Free Software Foundation, Inc.,                                       *
  24.  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  25.  ***************************************************************************/
  26.  
  27. #ifndef GTFONT_H
  28. #define GTFONT_H
  29.  
  30. #include <vector>
  31.  
  32. #include <QString>
  33. #include "scribusapi.h"
  34.  
  35. enum FontEffect {
  36.     NORMAL,
  37.     UNDERLINE,
  38.     STRIKETHROUGH,
  39.     SMALL_CAPS,
  40.     SUPERSCRIPT,
  41.     SUBSCRIPT,
  42.     OUTLINE,
  43.     FontEffectMAX
  44. };
  45.  
  46. enum FontWeight {
  47.     NO_WEIGHT,
  48.     DEMIBOLD,
  49.     EXTRABLACK,
  50.     EXTRABOLD,
  51.     EXTRAHEAVY,
  52.     EXTRALIGHT,
  53.     SEMIBOLD,
  54.     BLACK,
  55.     BOLD,
  56.     BOOK,
  57.     DEMI,
  58.     HEAVY,
  59.     LIGHT,
  60.     LITE,
  61.     MEDIUM,
  62.     REGULAR,
  63.     ROMAN,
  64.     FontWeightMAX
  65. };
  66.  
  67. enum FontSlant {
  68.     NO_SLANT,
  69.     ITALIC,
  70.     OBLIQUE,
  71.     FontSlantMAX
  72. };
  73.  
  74. enum FontWidth {
  75.     NO_WIDTH,
  76.     EXTRACONDENSED,
  77.     SEMICONDENSED,
  78.     ULTRACONDENSED,
  79.     EXTRACOMPRESSED,
  80.     SEMICOMPRESSED,
  81.     ULTRACOMPRESSED,
  82.     CONDENSED,
  83.     COMPRESSED,
  84.     FontWidthMAX
  85. };
  86.  
  87. /*
  88.     Font will do the font search in Scribus and in case a font
  89.     cannot be found it will launch the font substitution dialog.
  90. */
  91. class SCRIBUS_API gtFont
  92. {
  93. private:
  94.     int     setflags;
  95.     QString name;
  96.     QString family;
  97.     QString weight;
  98.     QString slant;
  99.     QString width;
  100.     QString append;
  101.     int     size;
  102.     bool    fontEffects[FontEffectMAX];
  103.     QString color;
  104.     int     shade;
  105.     QString strokeColor;
  106.     int     strokeShade;
  107.     /* Width of a character in percentages to it's "real width" */
  108.     int     hscale;
  109.     int  kerning;
  110.     bool useFullName;
  111.     int  weightIndex;
  112.     int  slantIndex;
  113.     int  widthIndex;
  114.     int smallestIndex;
  115.     int biggestIndex;
  116.     int index;
  117.     int tmpWeightIndex;
  118.     int tmpSlantIndex;
  119.     int tmpWidthIndex;
  120.     void initArrays();
  121.     void parseName();
  122.     void parseWeight();
  123.     void parseSlant();
  124.     void parseWidth();
  125.     void parseFamily();
  126.     int  find(const QString& where, const QString& what);
  127.  
  128. public:
  129.  
  130.     typedef enum
  131.     {
  132.         familyWasSet = 1,
  133.         weightWasSet = 2,
  134.         slantWasSet = 4,
  135.         widthWasSet = 8,
  136.         sizeWasSet  = 16,
  137.         effectWasSet = 32,
  138.         fillColorWasSet = 64,
  139.         fillShadeWasSet = 128,
  140.         strokeColorWasSet = 256,
  141.         strokeShadeWasSet = 512,
  142.         hscaleWasSet  = 1024,
  143.         kerningWasSet = 2048
  144.     } wasSetFlags;
  145.  
  146.     static const QString fontWeights[];
  147.     static const QString fontSlants[];
  148.     static const QString fontWidths[];
  149.  
  150.     void    noEffects();
  151.     bool    isToggled(FontEffect fe);
  152.     bool    toggleEffect(FontEffect fe);
  153.     int     getFlags();
  154.     int     getEffectsValue();
  155.     void    setName(QString newName);
  156.     void    setFamily(QString newFamily);
  157.     QString getFamily();
  158.     void    setWeight(FontWeight newWeight);
  159.     void    setWeight(QString newWeight);
  160.     QString getWeight();
  161.     void    setSlant(FontSlant newSlant);
  162.     void    setSlant(QString newSlant);
  163.     QString getSlant();
  164.     void    setWidth(FontWidth newWidth);
  165.     void    setWidth(QString newWidth);
  166.     QString getWidth();
  167.     void    setSize(int newSize);
  168.     void    setSize(double newSize);
  169.     void    setColor(QString newColor);
  170.     void    setShade(int newShade);
  171.     void    setStrokeColor(QString newColor);
  172.     void    setStrokeShade(int newShade);
  173.     QString getName();
  174.     QString getName(uint i);
  175.     static const int NAMECOUNT = 14;
  176.     int     getSize();
  177.     QString getColor();
  178.     int     getShade();
  179.     QString getStrokeColor();
  180.     int     getStrokeShade();
  181.     int     getHscale();
  182.     void    setHscale(int newHscale);
  183.     int     getKerning();
  184.     void    setKerning(int newKerning);
  185.     gtFont();
  186.     gtFont(const gtFont& f);
  187.     ~gtFont();
  188. };
  189.  
  190. #endif // GTFONT_H
  191.